<%@ page import="us.nchu.tomtiger.model.User" %>
<%@ page import="java.util.List" %>
<%@ page import="us.nchu.tomtiger.model.UserShow" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page isELIgnored="false" %>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />

<title>查看用户</title>
</head>
<body style="background: #FFF">
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 用户管理 <span class="c-gray en">&gt;</span> 查看用户 <a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="pd-20">
	<div class="mt-20">
		<table class="table table-border table-bordered table-bg table-hover table-sort">
			<thead>
				<tr class="text-c">
					<th width="80">姓名</th>
					<th width="80">手机号</th>
					<th width="120">学校名称</th>
					<th width="120">专业名称</th>
					<th width="80">类型</th>
					<th width="80">个人简介</th>
					<th width="80">其它联系方式</th>
					<th width="80">用户状态</th>
					<th width="120">操作</th>
				</tr>
			</thead>
			<tbody>

                <%
                    String[] types = new String[]{
                            "",
                            "学生",
                            "老师"
                    };
                    String[] contacts = new String[]{
                            "",
                            "QQ",
                            "微信",
                            "邮箱"
                    };

                    List<User> users = (List<User>) request.getAttribute("userList");
                    List<UserShow> userShows = (List<UserShow>) request.getAttribute("userShowList");

                    if (users.size() == 0) {
                        out.print("没有用户");
                    }
                    else {
                        User user;
                        UserShow userShow;
                        for (int i = 0; i < users.size(); i++) {
                            user = users.get(i);
                            userShow = userShows.get(i);

                            out.print("<tr class=\"text-c\">");
                            out.print("<td>" + (user.getNickName() == null ? "null" : java.net.URLDecoder.decode(user.getNickName(), "utf-8")) + "</td>");
                            out.print("<td>" + (user.getPhoneNumber() == null ? "null" : java.net.URLDecoder.decode(user.getPhoneNumber(), "utf-8")) + "</td>");
                            out.print("<td>" + (user.getSchoolName() == null ? "null" : java.net.URLDecoder.decode(user.getSchoolName(), "utf-8")) + "</td>");
                            out.print("<td>" + (user.getMajor() == null ? "null" : java.net.URLDecoder.decode(user.getMajor(), "utf-8")) + "</td>");
                            out.print("<td>" + types[user.getUserType()] + "</td>");
                            out.print("<td>" + (user.getIntro() == null ? "null" : java.net.URLDecoder.decode(user.getIntro(), "utf-8")) + "</td>");
                            out.print("<td>" + user.getContact() + "(" + contacts[user.getContact_type()] + ")" + "</td>");
                            out.print("<td class=\"td-status\">" +
                                    (user.getStatus() != 1 ? "<span class=\"label label radius\">被删除</span>" :
                                            "<span class=\"label label-success radius\">正常</span>") + "</td>");
                            out.print("<td class=\"f-14 td-manage\">");
                            out.print("<a style=\"text-decoration:none\" class=\"ml-5\" href=\"http://127.0.0.1:8085/user/" + userShow.getId() + "\" title=\"查看\"><i class=\"Hui-iconfont\">&#xe69c;</i></a>");
                            out.print("<a style=\"text-decoration:none\" class=\"ml-5\" href=\"http://127.0.0.1:8085/adminASDF/query-person/" + user.getPhoneNumber() + "\" title=\"编辑\"><i class=\"Hui-iconfont\">&#xe6df;</i></a>");
                            out.print("<a style=\"text-decoration:none\" class=\"ml-5\" onClick=\"deleteUser("+ user.getPhoneNumber() + ")\" href=\"javascript:;\" title=\"删除\"><i class=\"Hui-iconfont\">&#xe6e2;</i></a>");
                            out.print("</td></tr>");
                        }
                    }
                %>
                </tr>

				<%--<tr class="text-c">--%>
					<%--<td></td>--%>
					<%--<td></td>--%>
					<%--<td></td>--%>
					<%--<td></td>--%>
					<%--<td></td>--%>
					<%--<td class="text-l"><u style="cursor:pointer" class="text-primary" onClick="article_edit('查看','article-zhang.html','10001')" title="查看"></u></td>--%>
					<%--<td></td>--%>
					<%--<td class="td-status"><span class="label label-success radius">已审核</span></td>--%>
					<%--<td class="f-14 td-manage">--%>
						<%--<a style="text-decoration:none" class="ml-5" onClick="article_edit('修改信息','modify_person.html','10001')" href="javascript:;" title="编辑">--%>
							<%--<i class="Hui-iconfont">&#xe6df;</i>--%>
						<%--</a> --%>
						<%--<a style="text-decoration:none" class="ml-5" onClick="article_del(this,'10001')" href="javascript:;" title="删除">--%>
							<%--<i class="Hui-iconfont">&#xe6e2;</i>--%>
						<%--</a>--%>
					<%--</td>--%>
				<%--</tr>--%>
				
			</tbody>
		</table>
	</div>
</div>
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="lib/layer/1.9.3/layer.js"></script> 
<script type="text/javascript" src="lib/My97DatePicker/WdatePicker.js"></script> 
<script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="js/H-ui.js"></script> 
<script type="text/javascript" src="js/H-ui.admin.js"></script>
<script type="text/javascript" src="js/admin.js"></script>
<script type="text/javascript">
$('.table-sort').dataTable({
	"aaSorting": [[ 1, "desc" ]],//默认第几个排序
	"bStateSave": true,//状态保存
	"aoColumnDefs": [
	  //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
	  {"orderable":false,"aTargets":[0,8]}// 制定列不参与排序
	]
});


/*用户-编辑*/
function article_edit(title,url,id,w,h){
	var index = layer.open({
		type: 2,
		title: title,
		content: url
	});
	layer.full(index);
}
/*用户-删除*/
function article_del(obj,id){
	layer.confirm('确认要删除吗？',function(index){
		$(obj).parents("tr").remove();
		layer.msg('已删除!',1);
	});
}

</script> 
</body>
</html>